(function($){
	$.fn.FocusScroll = function(Objs){
		var defaults = {
			jqBox:"#FocusScroll",
			box_w:540,
			Interval:4000,
			bun:true,
			btn:true
		}
		var Objs = $.extend(defaults,Objs);
		this.each(function(){
			var that=$(this);
			var star=0,speed=1,number,pic_w,pic_ws,pic_html,num_html,time;
			if(Objs.box_w=="auto") Objs.box_w=$(window).width();
			var jqPic=$(Objs.jqBox).find(".pic");
			number=$(jqPic).find("li").length;
			pic_html=$(jqPic).html();
			$(jqPic).append(pic_html);
			pic_w=Objs.box_w*number*2;
			$(jqPic).css({"width":pic_w+"px"});
			$(jqPic).find("li").css({"width":Objs.box_w+"px"});
			if(Objs.btn==true){
			num_html="<div class='num'>";
			for(var t=0;t<number;t++){num_html+="<a></a>";}
			num_html+="</div>";
			$(Objs.jqBox).prepend(num_html);
			var jqNum=$(Objs.jqBox).find(".num");
			$(jqNum).find("a").eq(0).addClass("current");
			$(jqNum).find("a").bind({
			click:function(){
				clearInterval(time);
				star=$(this).index()-1;
				IMGbric();
				time=setInterval(IMGbric,Objs.Interval);
				return false;
				}
				});
		}
				
	function IMGbric(){
	star++;
	if(star>number) {star=1;jqPic.animate({"left":"0px"},0);};
	if(star==-1) {star=number-1; pic_ws=pic_w*0.5;$(jqPic).animate({"left":-pic_ws+"px"},0);};
	speed=star*-Objs.box_w;
	$(jqNum).find("a").removeClass("current");
	$(jqPic).find("li").removeClass("current");
	if(star==number){
	$(jqNum).find("a").eq(0).addClass("current");
	$(jqPic).find("li").eq(star).addClass("current");
	}
	else{
		$(jqNum).find("a").eq(star).addClass("current");
		$(jqPic).find("li").eq(star).addClass("current");
		}
	$(jqPic).stop(true,false).animate({"left":speed+"px"},300);
	}
	time=setInterval(IMGbric,Objs.Interval);
	
	if(Objs.bun==true){
		var bun_html="<a class='bun lbun' href='#'></a><a class='bun rbun' href='#'></a>";
		$(that).prepend(bun_html);
		$(that).find(".lbun").bind({
			click:function(){
				clearInterval(time);
				IMGbric();
				time=setInterval(IMGbric,Objs.Interval);
				return false;}
				});

	$(that).find(".rbun").bind({
		click:function(){
			clearInterval(time);
			star=star-2;
			IMGbric();
			time=setInterval(IMGbric,Objs.Interval);
			return false;}
			});
		}

		});
	};
})(jQuery);